<template>
  <view>
    <!-- 多商品banner -->
    <view class="list-item-center-one">
      <scroll-view :scroll-x="true">
        <image
          :src="goodsItem.pic"
          mode="aspectFill"
          v-for="(goodsItem, goodsIndex) in orderitem.goods_list"
          :key="goodsIndex"
        ></image>
      </scroll-view>
      <view>
        <view class="order-rightSide">
          <view>
            <view class="order-price">
              <text>￥</text>
              <text>{{ orderitem.pay_price | priceBeforeZero }}</text>
              <text>{{ orderitem.pay_price | priceAfterZero }}</text>
            </view>
            <view>{{$t('alipay.totalCount')}}{{ orderitem.goods_list.length }}{{$t('admin.theUnit')}}</view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {};
  },
  props: {
    orderitem: {
      type: Object,
      default: {},
    },
  },
  filters: {
    priceBeforeZero(val) {
      if (val.indexOf(".") < 0) return `${val}.`;
      return val.substr(0, val.indexOf("."));
    },
    priceAfterZero(val) {
      if (val.indexOf(".") < 0) return "00";
      return val.substr(val.indexOf("."), val.length);
    },
  },
  computed: {},
};
</script>

<style lang="scss" scoped>
.list-item-center-one {
  margin-top: 30rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;

  scroll-view {
    overflow-x: scroll;
    flex: 1;
    white-space: nowrap;

    image {
      margin-right: 10rpx;
      width: 160rpx;
      height: 160rpx;
      border-radius: 10rpx;
      display: inline-block;
    }
    image:last-child {
      margin-right: 170rpx;
    }
  }

  .order-rightSide {
    width: 200rpx;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 11;
    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0),
      #ffffff,
      #ffffff
    );

    view:first-child {
      display: flex;
      flex-direction: column;
      text-align: right;
      width: 100%;

      .order-price {
        font-weight: bold;
        font-size: 34rpx;
        color: #262626;
        flex-direction: initial;
        align-items: baseline;
        justify-content: flex-end;

        text:first-child {
          font-size: 22rpx;
        }
        text:nth-child(2) {
          font-size: 34rpx;
        }
        text:last-child {
          font-size: 22rpx;
        }
      }
      view:last-child {
        margin-top: 4rpx;
        font-size: 24rpx;
        color: #8f8f8f;
      }
    }
  }
}
</style>
